<?php

use yii\db\Migration;

class m210915_111731_minerva_allow_ext extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%minerva_allow_ext}}', [
            'id' => "int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id'",
            'role_id' => "int(11) NOT NULL COMMENT '角色id'",
            'ext' => "varchar(8) NOT NULL COMMENT '扩展名'",
            'content' => "text NULL COMMENT '内容'",
            'PRIMARY KEY (`id`)'
        ], "ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='大数据系统-扩展名表'");
        
        /* 索引设置 */
        
        
        /* 表数据 */
        $this->insert('{{%minerva_allow_ext}}',['id'=>'1','role_id'=>'1','ext'=>'txt','content'=>'[{\\\\\\\\\\\\\\\\\\\"key\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"first\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"value\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"您有新订单了，请及时处理\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"color\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"#173177\\\\\\\\\\\\\\\\\\\"},{\\\\\\\\\\\\\\\\\\\"key\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"keyword1\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"value\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"核桃\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"color\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"#173177\\\\\\\\\\\\\\\\\\\"},{\\\\\\\\\\\\\\\\\\\"key\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"keyword2\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"value\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"{order.pay_time}\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"color\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"#173177\\\\\\\\\\\\\\\\\\\"},{\\\\\\\\\\\\\\\\\\\"key\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"keyword3\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"value\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"{order.receiver_address}-{order.receiver_region_name}-{order.receiver_zip}\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"color\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"#173177\\\\\\\\\\\\\\\\\\\"},{\\\\\\\\\\\\\\\\\\\"key\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"keyword4\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"value\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"{order.receiver_name}\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"color\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"#173177\\\\\\\\\\\\\\\\\\\"},{\\\\\\\\\\\\\\\\\\\"key\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"keyword5\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"value\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"已支付\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"color\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"#173177\\\\\\\\\\\\\\\\\\\"},{\\\\\\\\\\\\\\\\\\\"key\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"remark\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"value\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"{order.seller_memo}\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\"color\\\\\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\"}]']);
        
        /* 设置外键约束 */
        $this->execute('SET foreign_key_checks = 1;');
    }

    public function down()
    {
        $this->execute('SET foreign_key_checks = 0');
        /* 删除表 */
        $this->dropTable('{{%minerva_allow_ext}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

